package com.ai.controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ai.common.controller.BaseController;
import com.ai.common.model.vo.BackOperatorVO;
import com.ai.model.edu.cms.backoperator.Resources;


@Controller
public class BackendAction extends BaseController {

    /**
     * Description ： 跳转到菜单页面<br>
     * 
     * wumc
     * 
     * @return
     * @since
     *
     */
    @RequestMapping("/backend/toIndex")
    public String toIndex(HttpServletRequest re) {
        // 获取用户信息
        BackOperatorVO backOperatorVO = this.getBackendOperator(re);
        re.setAttribute("backendOperatorVO", backOperatorVO);
        return "backend/index";
    }

    /**
     * Description ： 跳转到验证码页面<br>
     * 
     * wumc
     * 
     * @return
     * @since
     *
     */
    @RequestMapping("/backend/toValidate")
    public String toValidate() {
        return "backend/validatePage";
    }

    /**
     * Description ： 菜单页面<br>
     * 
     * wumc
     * 
     * @return
     * @since
     *
     */
    @RequestMapping("/backend/gainMen")
    public @ResponseBody List<Resources> gainMen() {
        List<Resources> ms = new ArrayList<Resources>();
        Resources r1 = new Resources(1L, "", "类目属性管理", 0L, 1);
        Resources r8 = new Resources(8L, "/category/toCategorySetting.action", "类目管理", 1L, 1);
        Resources r9 = new Resources(9L, "/category/toDimAttributeLibrary.action", "属性库管理", 1L, 1);
        Resources r10 = new Resources(10L, "http://picroom.ailkcloud.com/piccenter/toPicUpload.action", "图片空间", 1L, 1);
        Resources r14 = new Resources(14L, "/categoryBrand/toBrandCategorySetting.action", "默认值管理", 1L, 1);
        Resources r16 = new Resources(16L, "/category/toWebSiteCategory.action", "前台类目管理", 1L, 1);

        Resources r2 = new Resources(2L, "", "商品管理", 0L, 1);
        Resources r20 = new Resources(20L, "/brand/toDimBrand.action", "品牌管理", 2L, 1);
        Resources r21 = new Resources(21L, "/categoryBrand/toManageCategoryBrand.action", "类目品牌管理", 2L, 1);
        Resources r22 = new Resources(22L, "/productMaintain/toProductMaintainList.action", "商品维护", 2L, 1);

        Resources r5 = new Resources(5L, "", "资源管理", 0L, 1);
        Resources r51 = new Resources(51L, "/telenumber/toDimNumberPoolForms.action", "号码池管理", 5L, 1);
        Resources r52 = new Resources(52L, "/telenumber/toTeleNumberList.action", "号码管理", 5L, 1);
        Resources r53 = new Resources(53L, "/meals/toDimMealsForms.action", "套餐体系管理", 5L, 1);
        Resources r54 = new Resources(54L, "/meals/toDimMeals.action", "套餐管理", 5L, 1);
        Resources r55 = new Resources(55L, "/meals/toDimCellPhonePlans.action", "合约管理", 5L, 1);

        Resources r15 = new Resources(13L, "/prod/toPublicProd.action", "商品发布", 2L, 1);

        Resources r3 = new Resources(3L, "", "用户管理", 0L, 1);
        Resources r30 = new Resources(23L, "/backend/toUserControllerIndex.action", "用户管理", 3L, 1);

        /** 演示需要，暂时注释订单相关菜单 */
        Resources r4 = new Resources(4L, "", "订单管理", 0L, 1);
        Resources r24 = new Resources(24L, "/order/findSoPgInfo.action", "订单查询", 4L, 1);
        Resources r25 = new Resources(25L, "/order/toUnFileSoIndex.action", "订单归档", 4L, 1);
        Resources r26 = new Resources(26L, "/order/toRefundPage.action", "订单退款", 4L, 1);
        Resources r27 = new Resources(27L, "/order/toVerifyPgIndex.action", "订单审核", 4L, 1);
        Resources r28 = new Resources(28L, "/order/findDeliverySoPgInfo.action", "订单发货", 4L, 1);
        Resources r29 = new Resources(29L, "/order/findSoAccountPgInfo.action", "订单开户", 4L, 1);
        Resources r6 = new Resources(6L, "", "配送管理", 0L, 1);
        Resources r60 = new Resources(60L, "/delivery/toDeliverySupplierIndex.action", "配送公司管理", 6L, 1);

        Resources r61 = new Resources(61L, "/menu/menuList.action", "菜单管理", 3L, 1);
        ms.add(r1);
        ms.add(r8);
        ms.add(r9);
        ms.add(r10);
        ms.add(r14);
        ms.add(r16);
        ms.add(r2);
        ms.add(r20);
        ms.add(r21);
        ms.add(r22);
        ms.add(r5);
        ms.add(r51);
        ms.add(r52);
        ms.add(r53);
        ms.add(r54);
        ms.add(r55);
        ms.add(r15);
        ms.add(r3);
        ms.add(r30);

        ms.add(r4);
        ms.add(r24);
        ms.add(r25);
        ms.add(r26);
        ms.add(r27);
        ms.add(r28);
        ms.add(r29);

        ms.add(r6);
        ms.add(r60);
        ms.add(r61);
        return ms;
    }
}
